<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>晴天医诊</title>
    <meta name="description" content="晴天医诊">
    <meta name="keywords" content="晴天医诊">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <!-- 引入组件库 -->
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
    <style type="text/css">
    .el-main{
        position: absolute;
        top: 70px;
        bottom: 0px;
        left: 200px;
        right: 10px;
        padding: 0;
    }
    </style>
</head>
<body class="hold-transition skin-purple sidebar-mini">
    <div id="app">
        <el-container>
            <el-header  class="main-header" style="height:70px;">
                <nav class="navbar navbar-static-top" :class=''>
                    <!-- Logo -->
                    <a href="#" class="logo" style="text-align:center">
                        <font color="white">用户管理系统</font>
                    </a>
                    <div class="right-menu">
                        <span class="help"><i class="fa fa-exclamation-circle" aria-hidden="true"></i>帮助</span>
                        <el-dropdown class="avatar-container right-menu-item" trigger="click">
                            <div class="avatar-wrapper">
                                <img src="../img/user2-160x160.jpg" class="user-avatar">
                                {{username}}
                            </div>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item divided>
                                    <span style="display:block;">修改密码</span>
                                </el-dropdown-item>
                                <a href="/logout.do">
                                <el-dropdown-item divided>
                                    <span style="display:block;">退出</span>
                                    </el-dropdown-item></a>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
                </nav>
            </el-header>
            <el-container>
                <el-aside width="200px">
                    <el-menu>
                        <el-submenu v-for="menu in menuList" :index="menu.path">
                            <template slot="title">
                                <i class="fa" :class="menu.icon"></i>
                              <span>{{menu.name}}</span>
                            </template>
                            <template v-for="child in menu.children">
                                <el-menu-item :index="child.path">
                                    <a :href="child.linkUrl" target="right"><span>{{child.name}}</span></a>
                                </el-menu-item>
                            </template>
                        </el-submenu>
                    </el-menu>
                </el-aside>
                <el-container>
                    <iframe name="right" class="el-main" src="ordersetting.html" width="100%" height="580px" frameborder="0"></iframe>
                </el-container>
            </el-container>
        </el-container>
    </div>
</body>
<script>
    new Vue({
        el: '#app',
        data: {
            menuList: [
                {
                    "path": "1",
                    "name": "账号管理",
                    "icon":"fa-user-md",
                    "children": [
                        {
                            "path": "/1-1",
                            "name": "用户管理",
                            "linkUrl":"user.html",
                            "children":[]
                        },
                        {
                            "path": "/1-2",
                            "name": "角色管理",
                            "children":[]
                        },
                        {
                            "path": "/1-3",
                            "name": "权限管理",
                            "linkUrl":"report_member.html",
                            "children":[]
                        },
                    ]
                }
            ],
            username: ''
        },
        mounted() {
            this.getUsername();
            this.getMenu();
        },
        methods: {
            getUsername() {
                axios.get("/user/GetLoginUsername.do").then(res => {
                        if (res.data.flag) {
                            this.username = res.data.data;
                        } else {
                            this.$message.error(res.data.message);
                        }
                    }
                )
            },
            getMenu() {
                axios.get("/menu/getMenu.do").then(res => {
                    if (res.data.flag) {
                        this.menuList = res.data.data;
                    } else {
                        this.$message.error(res.data.message);
                    }
                })
            }
        }
    })
    $(function() {
            var wd = 200;
            $(".el-main").css('width', $('body').width() - wd + 'px');
    });
</script>
</html>
